import React from 'react';

type Props = {
  className?: string;
  name: string;
  size?: number;
  style?: Obj;
  onClick?: () => void;
};

function FontIcon({ className = '', name, size, style = {}, onClick }: Props) {
  return (
    <i
      className={
        'iconfont icon-' + name.replace(/^icon-/, '') + ` ${className}`
      }
      style={{ ...style, ...(size ? { fontSize: size } : {}) }}
      onClick={onClick}
    ></i>
  );
}

export default FontIcon;
